using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace Autenticazione
{
	public class Coach : Page
	{
		protected HtmlForm form1;
		protected TextBox txtFullName;
		protected RequiredFieldValidator FullNameValidator;
		protected TextBox txtTelefono;
		protected RequiredFieldValidator TelValidator;
		protected RegularExpressionValidator RegTelefonoCoach;
		protected Button btnSalvaCoach;
		protected void Page_Load(object sender, EventArgs e)
		{
			if (this.Session["EMail"] == null)
			{
				base.Response.Redirect("Autenticazione.aspx");
			}
		}
		protected void btnSalvaCoach_Click(object sender, EventArgs e)
		{
			BusinessObject.Coach coach = new BusinessObject.Coach();
			if (this.Session["EMail"] == null)
			{
				base.Response.Redirect("Autenticazione.aspx");
			}
			coach.EMail = this.Session["EMail"].ToString();
			coach.FullName = this.txtFullName.Text.Replace("'", "''");
			coach.Phone = this.txtTelefono.Text;
			if (this.Page.IsValid)
			{
				coach.Salva();
				base.ClientScript.RegisterClientScriptBlock(base.GetType(), "Close", "window.close(); window.opener.Aggiorna()", true);
			}
		}
	}
}
